using System.IO;
using Const;
using UnityEngine;

namespace Services
{
    public class LoadConfigService
    {
        public static LoadConfigService Instance { get; private set; }=new LoadConfigService();

        public T LoadJson<T>() where T : class
        {
            if (File.Exists(ResPath.DataPath))
            {
                string json = File.ReadAllText(ResPath.DataPath);
                return JsonUtility.FromJson<T>(json);
            }

            return null;
        }
    }
}